﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CalcSharp.Core.ServerPackets;

namespace CalcDataServ
{
    public sealed class ServHelper
    {
        private ServHelper() { }

        public static ServerInfo GetServerInfoPacket()
        {
            ServerInfo ret = new ServerInfo();
            ret.ServerTime = DateTime.Now;
            ret.StoredData = 0;//Program.Db.Data1.Sum(c => c.DataLength);
            ret.NumberOfUsers = Program.Db.Owner.Count();
            var q = from c in Program.Db.Data1 group c by c.Varname into g select g;
            ret.StoredVariables = q.Count();
            ret.ServerVersion = new Version(1, 0, 0, 0);
            return ret;
        }

        public static string HandleListingRequest(Uri uri)
        {
            return uri.Query;
        }
    }
}
